<HTML><HEAD><TITLE>read(-Term)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Term I/O</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>read(-Term)</H1>
Succeeds if the next term from the input stream is successfully read and
unified with Term.


<DL>
<DT><EM>Term</EM></DT>
<DD>Prolog term.
</DD>
</DL>
<H2>Description</H2>
   Used to read the next term from the input stream and unify it with Term.
   The term must be in Prolog term format i.e.  terminated by fullstop (a
   period and a blank space character), neither of which are retained by
   Prolog.

<P>
   End of file acts like fullstop.  If only end of file is read, the event
   190 is raised and the default handler unifies Term with the atom
   end_of_file.

<P>
   The default action for syntax errors is to print a warning and fail.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>read(-) is semidet
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Fail Conditions</H3>
Fails if a syntax error was detected and no term could be read
<H3>Exceptions</H3>
<DL>
<DT><EM>(190) end of file reached </EM>
<DD>End of file was encountered before reading any character.
<DT><EM>(198) reading past the file end </EM>
<DD>Trying to read even after the error 190 was raised.
</DL>
<H2>Examples</H2>
<PRE>   Equivalent to read(input, Term).  (see read/2 for details).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/ioterm/read-2.html">read / 2</A>
</BODY></HTML>
